package com.edu.chat.web.dto;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.List;

/**
 * @program: KQAIA
 * @description:
 * @author: 无恙
 * @create: 2025-03-19 16:08
 **/

@Data
@NoArgsConstructor
public class PageResult<V> implements Serializable {
	private static final long serialVersionUID = 1L;

	private Long total;

	private Long totalPages;

	private Long currentPage;

	private List<V> records;

	public PageResult(Long total, Long totalPages, Long currentPage, List<V> records) {
		this.total = total;
		this.totalPages = totalPages;
		this.currentPage = currentPage;
		this.records = records;
	}

	public static <V> PageResult<V> of(Long total, Long pages, Long currentPage, List<V> records) {
		return new PageResult<>(total, pages, currentPage, records);
	}


}

